无障碍环境正在使你的网页便于所有人使用——甚至是残疾人。
在这个课程中,你将建立一个测验网页。你将学习诸如键盘快捷键、ARIA 属性和设计最佳实践等无障碍工具。
显示如下
来自于freecodecamp
Accessibility Quiz
HTML/CSS Quiz
源码
index.md
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="description" content="freeCodeCamp Accessibility Quiz practice project" /> <title>Accessibility Quiz</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <header> <img id="logo" alt="freeCodeCamp" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg"> <h1>HTML/CSS Quiz</h1> <nav> <ul> <li><a accesskey="S"href="#student-info">INFO</a></li> <li><a accesskey="A"href="#html-questions">HTML</a></li> <li><a accesskey="v"href="#css-questions">CSS</a></li> </ul> </nav> </header> <main> <form method="post" action="https://freecodecamp.org/practice-project/accessibility-quiz"> <section role="region" aria-labelledby="student-info"> <h2 id="student-info">Student Info</h2> <div class="info"> <label for="student-name">Name:</label> <input type="text" name="student-name" id="student-name" /> </div> <div class="info"> <label for="student-email">Email:</label> <input type="email" name="student-email" id="student-email" /> </div> <div class="info"> <label for="birth-date">Date of Birth:</label> <input type="date" name="birth-date" id="birth-date" /> </div> </section> <section role="region" aria-labelledby="html-questions"> <h2 id="html-questions">HTML</h2> <div class="question-block"> <h3><span class="sr-only">Question</span>1</h3> <fieldset class="question" name="html-question-one"> <legend> The legend element represents a caption for the content of its parent fieldset element </legend> <ul class="answers-list"> <li> <label for="q1-a1"> <input type="radio" id="q1-a1" name="q1" value="true" /> True </label> </li> <li> <label for="q1-a2"> <input type="radio" id="q1-a2" name="q1" value="false" /> False </label> </li> </ul> </fieldset> </div> <div class="question-block"> <h3><span class="sr-only">Question</span>2</h3> <fieldset class="question" name="html-question-two"> <legend> A label element nesting an input element is required to have a for attribute with the same value as the input's id </legend> <ul class="answers-list"> <li> <label for="q2-a1"> <input type="radio" id="q2-a1" name="q2" value="true" /> True </label> </li> <li> <label for="q2-a2"> <input type="radio" id="q2-a2" name="q2" value="false" /> False </label> </li> </ul> </fieldset> </div> </section> <section role="region" aria-labelledby="css-questions"> <h2 id="css-questions">CSS</h2> <div class="formrow"> <div class="question-block"> <label for="selector">Can the CSS margin property accept negative values?</label> </div> <div class="answer"> <select name="selector" id="selector" required> <option value="">Select an option</option> <option value="yes">Yes</option> <option value="no">No</option> </select> </div> <div class="question-block"> <label for="css-textarea">Do you have any questions:</label> </div> <div class="answer"> <textarea id="css-textarea" name="css-questions" rows="5" cols="24"></textarea> </div> </div> </section> <button type="submit">Send</button> </form> </main> <footer> <address> <a href="https://freecodecamp.org">freeCodeCamp</a><br /> San Francisco<br /> California<br /> USA </address> </footer> </body> </html>
|
styles.css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="description" content="freeCodeCamp Accessibility Quiz practice project" /> <title>Accessibility Quiz</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <header> <img id="logo" alt="freeCodeCamp" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg"> <h1>HTML/CSS Quiz</h1> <nav> <ul> <li><a accesskey="S"href="#student-info">INFO</a></li> <li><a accesskey="A"href="#html-questions">HTML</a></li> <li><a accesskey="v"href="#css-questions">CSS</a></li> </ul> </nav> </header> <main> <form method="post" action="https://freecodecamp.org/practice-project/accessibility-quiz"> <section role="region" aria-labelledby="student-info"> <h2 id="student-info">Student Info</h2> <div class="info"> <label for="student-name">Name:</label> <input type="text" name="student-name" id="student-name" /> </div> <div class="info"> <label for="student-email">Email:</label> <input type="email" name="student-email" id="student-email" /> </div> <div class="info"> <label for="birth-date">Date of Birth:</label> <input type="date" name="birth-date" id="birth-date" /> </div> </section> <section role="region" aria-labelledby="html-questions"> <h2 id="html-questions">HTML</h2> <div class="question-block"> <h3><span class="sr-only">Question</span>1</h3> <fieldset class="question" name="html-question-one"> <legend> The legend element represents a caption for the content of its parent fieldset element </legend> <ul class="answers-list"> <li> <label for="q1-a1"> <input type="radio" id="q1-a1" name="q1" value="true" /> True </label> </li> <li> <label for="q1-a2"> <input type="radio" id="q1-a2" name="q1" value="false" /> False </label> </li> </ul> </fieldset> </div> <div class="question-block"> <h3><span class="sr-only">Question</span>2</h3> <fieldset class="question" name="html-question-two"> <legend> A label element nesting an input element is required to have a for attribute with the same value as the input's id </legend> <ul class="answers-list"> <li> <label for="q2-a1"> <input type="radio" id="q2-a1" name="q2" value="true" /> True </label> </li> <li> <label for="q2-a2"> <input type="radio" id="q2-a2" name="q2" value="false" /> False </label> </li> </ul> </fieldset> </div> </section> <section role="region" aria-labelledby="css-questions"> <h2 id="css-questions">CSS</h2> <div class="formrow"> <div class="question-block"> <label for="selector">Can the CSS margin property accept negative values?</label> </div> <div class="answer"> <select name="selector" id="selector" required> <option value="">Select an option</option> <option value="yes">Yes</option> <option value="no">No</option> </select> </div> <div class="question-block"> <label for="css-textarea">Do you have any questions:</label> </div> <div class="answer"> <textarea id="css-textarea" name="css-questions" rows="5" cols="24"></textarea> </div> </div> </section> <button type="submit">Send</button> </form> </main> <footer> <address> <a href="https://freecodecamp.org">freeCodeCamp</a><br /> San Francisco<br /> California<br /> USA </address> </footer> </body> </html>
|
p u b l i c
2024/09/21 21:01:13 CST
L I C E N S E